/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mutual.entidades;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author yue
 */
@Entity
@Table(name = "TiempoLimite")
@NamedQueries({
    @NamedQuery(name = "TiempoLimite.findAll", query = "SELECT t FROM TiempoLimite t"),
    @NamedQuery(name = "TiempoLimite.findById", query = "SELECT t FROM TiempoLimite t WHERE t.id = :id"),
    @NamedQuery(name = "TiempoLimite.findByTiempo", query = "SELECT t FROM TiempoLimite t WHERE t.tiempo = :tiempo")})
public class TiempoLimite implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "tiempo")
    private String tiempo;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "tiempoLimite")
    private Collection<Prestaciones> prestacionesCollection;

    public TiempoLimite() {
    }

    public TiempoLimite(Integer id) {
        this.id = id;
    }

    public TiempoLimite(Integer id, String tiempo) {
        this.id = id;
        this.tiempo = tiempo;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        Integer oldId = this.id;
        this.id = id;
        changeSupport.firePropertyChange("id", oldId, id);
    }

    public String getTiempo() {
        return tiempo;
    }

    public void setTiempo(String tiempo) {
        String oldTiempo = this.tiempo;
        this.tiempo = tiempo;
        changeSupport.firePropertyChange("tiempo", oldTiempo, tiempo);
    }

    public Collection<Prestaciones> getPrestacionesCollection() {
        return prestacionesCollection;
    }

    public void setPrestacionesCollection(Collection<Prestaciones> prestacionesCollection) {
        this.prestacionesCollection = prestacionesCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TiempoLimite)) {
            return false;
        }
        TiempoLimite other = (TiempoLimite) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return tiempo;
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }

}
